<style>
	.layui-form-label{width:90px;margin-left: 40px;}
	.layui-form{height: 240px;margin-top: 35px;}
	.layui-input-block{margin-left: 160px!important;margin-top:10px;}
	.layui-textarea{height: 120px!important;}.layui-form-text{display: none;}
</style>
<form class="layui-form" action="" method="post" id="editForm">
	<input type="hidden" name="status"  value="{$status}">
	<input type="hidden" name="order_id"  value="{$order_id}">
	<input type="hidden" name="need_put_num"  value="{$need_put_num}">
	<input type="hidden" name="tail_goods_dff"  value="{$tail_goods_dff}">
	<input type="hidden" name="size_name"  value="{$size_name}">

	<div class="layui-inline">
		<label class="layui-form-label">无需处理原因: </label>
		<div class="layui-input-inline">
				<select name="reason" class="field-reason" lay-filter="reasonFilter">
					<option value="" selected="">请选择</option>
					<option value="1">有报废品</option><option value="2">车间补片</option>
					<option value="3">其它</option></select>
		</div>
		<div class="layui-form-item layui-form-text">
			<div class="layui-input-block">
				<textarea name="reason_content" placeholder="请输入-其它原因" class="layui-textarea"></textarea>
			</div>
		</div>
	</div>

	<div class="pop-bottom-bar">
		<input type="hidden" class="field-id" name="id">
		<button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formSubmit3" >确定</button>
		<a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
	</div>
</form>


{include file="system@block/layui" /}

<script type="text/javascript">
	layui.use(['jquery', 'layer', 'form'], function() {
		var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

		//监听下拉选择
		form.on('select(reasonFilter)', function(data){

			var reason_id=data.value;
			if(reason_id==3){
				$('.layui-form-text').show();
			}else{
				 $('.layui-form-text').hide();
				 $('.layui-textarea').val('');
			}

		});

		//监听提交
		form.on('submit(formSubmit3)', function(data){
			var select_value=$('.layui-this').attr('lay-value');
			var reason_content=$('.layui-textarea').val();
			if(select_value =='' || typeof(select_value)=="undefined"){
				layer.msg('请选择原因', {time: 1800, icon: 2});
				return false;
			}

			//预防重复提交
			var DISABLED='layui-btn-disabled';
			$(':button').addClass(DISABLED);
			$(':button').attr('disabled','disabled');
			setTimeout(function() {
				$(":button").removeClass(DISABLED);
				$(":button").removeAttr('disabled');
			}, 4000);//4秒后才能点击

			data.field.reason=select_value;
			data.field.reason_content=reason_content;
			$.post("{:url('notNeedHandle')}", {action:'notNeedHandleAction',data:data.field}, function (res) {
				if (res.code == 1) {
					layer.msg(res.msg, {time: 1800, icon: 1}, function () {
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
						parent.reloadTable();
					});
				} else {
					layer.msg(res.msg, {time: 1800, icon: 2});
				}
			}, 'json');

			return false;
		});

	});
</script>